package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWarehouseOtherinItemDAO;
import com.cssy.xxkj.logic.entity.LogicWarehouseOtherinItemDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-17
 */
public class LogicWarehouseOtherinItemDAOImpl extends SqlMapClientDaoSupport implements LogicWarehouseOtherinItemDAO {

    /**
     * 插入数据
     * @param logicWarehouseOtherinItemDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehouseOtherinItemDO(LogicWarehouseOtherinItemDO logicWarehouseOtherinItemDO) {
        Object id = getSqlMapClientTemplate().insert("LogicWarehouseOtherinItem.insert", logicWarehouseOtherinItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehouseOtherinItemDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehouseOtherinItemDOByExample(LogicWarehouseOtherinItemDO logicWarehouseOtherinItemDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherinItem.countByDOExample", logicWarehouseOtherinItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehouseOtherinItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehouseOtherinItemDO(LogicWarehouseOtherinItemDO logicWarehouseOtherinItemDO) {
        int result = getSqlMapClientTemplate().update("LogicWarehouseOtherinItem.update", logicWarehouseOtherinItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehouseOtherinItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehouseOtherinItemDO> findListByExample(LogicWarehouseOtherinItemDO logicWarehouseOtherinItemDO) {
        List<LogicWarehouseOtherinItemDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseOtherinItem.findListByDO", logicWarehouseOtherinItemDO);
        return list;
    }
    
    public List<LogicWarehouseOtherinItemDO> findListByMap(Map<String, Object> paramMap){
    	 List<LogicWarehouseOtherinItemDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseOtherinItem_ex.findListByMap", paramMap);
         return list;
    }

    /**
     * 根据主键获取logicWarehouseOtherinItemDO
     * @param id
     * @return logicWarehouseOtherinItemDO
     */
    public LogicWarehouseOtherinItemDO findLogicWarehouseOtherinItemDOByPrimaryKey(String id) {
        LogicWarehouseOtherinItemDO logicWarehouseOtherinItemDO = (LogicWarehouseOtherinItemDO) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherinItem.findByPrimaryKey", id);
        return logicWarehouseOtherinItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehouseOtherinItemDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseOtherinItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehouseOtherinItemDO> findByPid(String pid) {
		List<LogicWarehouseOtherinItemDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseOtherinItem_ex.findByPid", pid);
        return list;
	}

	@Override
	public Integer deleteByPid(String id) {
		 Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseOtherinItem_ex.deleteByPid", id);
	     return rows;
	}

	@Override
	public List<LogicWarehouseOtherinItemDO> find(SearchConditions scs)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicWarehouseOtherinItem_ex.find", scs);
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		return (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherinItem_ex.count", scs);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

}